package hl.demo;


public class Box<Type> {

    private Type t;

    public void add(Type t) {
        this.t = t;
    }

    public Type get() {
        return t;
    }

    public static void main(String[] args) {
        Box<Integer> Box1 = new Box<Integer>();
        Box<String>  Box2 = new Box<String>();

        Box1.add(new Integer(10));
        Box2.add(new String("菜鸟教程"));

        System.out.printf("整型值为 :%d\n\n", Box1.get());
        System.out.printf("字符串为 :%s\n", Box2.get());
    }
}
